package com.jic.manager.tuple;

import java.io.Serializable;

/**
 * description: Tuple
 * date: 2020-01-10 11:58
 * author: wangys
 * version: 1.0
 */
public class Tuple<F, S> implements Serializable {
    private static final long serialVersionUID = 1460276769987686853L;
    private F f;
    private S s;

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        } else if (obj == null) {
            return false;
        } else if (this.getClass() != obj.getClass()) {
            return false;
        } else {
            Tuple other = (Tuple)obj;
            if (this.f == null) {
                if (other.f != null) {
                    return false;
                }
            } else if (!this.f.equals(other.f)) {
                return false;
            }

            if (this.s == null) {
                if (other.s != null) {
                    return false;
                }
            } else if (!this.s.equals(other.s)) {
                return false;
            }

            return true;
        }
    }

    public int hashCode() {
        long result = this.f != null ? (long)this.f.hashCode() : 0L;
        result = 31L * result + (long)(this.s != null ? this.s.hashCode() : 0);
        return (int)result;
    }

    public F getF() {
        return this.f;
    }

    public S getS() {
        return this.s;
    }

    public Tuple<F, S> setF(F f) {
        this.f = f;
        return this;
    }

    public Tuple<F, S> setS(S s) {
        this.s = s;
        return this;
    }

    public String toString() {
        return "Tuple(f=" + this.getF() + ", s=" + this.getS() + ")";
    }

    public Tuple() {
    }

    public Tuple(F f, S s) {
        this.f = f;
        this.s = s;
    }
}
